<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数组</title>
</head>
<body>
    <script>
        //1.定义数组  js里面数组长度可以变
        let arr = [1,2,3,45];
        for(let i=0;i<arr.length;i++){
            document.write(arr[i]+"<br>");
        }

        document.write("===============<br>")

        //复制数组
        let arr1=[...arr];
        for(let i=0;i<arr1.length;i++){
            document.write(arr1[i]+"<br>");
        }

        document.write("===============<br>")

        //合并数组
        let arr2=[4,5,6,7];
        let arr3=[...arr1,...arr2];
        for(let i=0;i<arr3.length;i++){
            document.write(arr3[i]+"<br>");
        }

        document.write("===============<br>")

        //字符串转化数组
        let arr4=[..."zzzzzxxxx"];
        for(let i=0;i<arr4.length;i++){
            document.write(arr4[i]+"<br>");
        }


    </script>
</body>
</html>